package main

import (
	"github.com/gin-gonic/gin"
	"net/http"
)

type Goods struct {
	Id     string `uri:"id" binding:"required,uuid"`
	Action string `uri:"action" binding:"required"`
}

func main() {
	router := gin.Default()

	router.GET("/goods/:id/:action", func(c *gin.Context) {
		var goods Goods
		if err := c.ShouldBindUri(&goods); err != nil {
			c.Status(404)
			return
		}
		c.JSON(http.StatusOK, gin.H{
			"id": goods.Id,
			"action": goods.Action,
		})
	})

	router.Run(":8080")

}
